<template>
	<view>
		<!-- 五楼推荐图-->
		<view style="padding:0 20rpx;box-sizing: border-box;">
			<view class="" style="background-color:#fff;border-radius: 16rpx;">
				<view class=" mt-2 pb-2">
					<view class="d-flex flex-wrap">
						<view class="grid" @tap="godetail(List.id)" v-for="(List) in list" :key="List.id">
							<view class="">
								<image class="grid-image" :src="List.cover_ico" mode="scaleToFill"
									style="width: 100%;height: 300upx;margin:0"></image>
								<view class="text">{{List.goods_name}}</view>
							</view>
							<view class="grid-text">
								{{List.product_introduct}}
							</view>
							<view class="d-flex">
								<view class="flex-1 price">￥{{List.member_price}} </view>
								<view class="sale sale1">已售</view>
								<view class="six  sale1">{{List.sell_num}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				list: [],
				type: 1
			}
		},

		computed: {
			...mapState(['hasLogin']),
		},

		onLoad(options) {
			if (!this.hasLogin) {
				this.$api.msg('请先登录！', 'none');
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/login/login',
					})
				}, 1000)
				return false;
			}

			this.type = options.type;
			this.getProduts();
		},
		methods: {
			// 获取报单产品
			async getProduts() {
				//报单产品
				let bill = 'bill' + this.type;
				let token = uni.getStorageSync('token')
				let pdata = await this.$myRequest({
					url: '/billShop',
					data: {
						token: token,
						bill: bill
					}
				})

				this.list = pdata.data.data
			},

			//商品详情
			async godetail(id) {
				uni.navigateTo({
					url: '/pages/detail/detail?id=' + id
				})
			},

		}
	}
</script>
<style>
	body {
		background-color: #eff0f2;
	}
</style>
<style lang="scss">
	.main_body {}

	.bar_then {
		height: 330rpx;
		background-color: #fff;
		padding: 6rpx;
		width: 28%;
		display: flex;
		align-items: center;
		flex-direction: column;
		border-radius: 12rpx;
	}

	.bar_btn {
		background-color: #1cb0fd;
		color: #fff;
		padding: 6rpx 30rpx;
		border-radius: 50rpx;
		font-size: 24rpx;
		margin-top: 6rpx;
	}

	.bar_main {
		background: linear-gradient(to bottom, #fdd9b2, #f9ebc4);
		border-radius: 16rpx;
		padding-bottom: 30rpx;
	}

	.super_main {
		background: linear-gradient(to bottom, #cef1fe, #d0f0fd);
		border-radius: 16rpx;
		padding-bottom: 10rpx;
	}

	.bar_title {
		display: flex;
		justify-content: center;
		line-height: 100rpx;
		color: #f59c08;
		font-size: 34rpx;
		font-weight: 600;
		align-items: center;
	}

	.super_title {
		// line-height: 100rpx;
		color: #20b4fb;
		font-size: 34rpx;
		font-weight: 600;
		align-items: center;
		padding: 30rpx 0;
	}

	.bar_title_ra {
		background-color: #f59c08;
		width: 5px;
		height: 5px;
		border-radius: 50%;
		margin: 0 10rpx;
	}

	.search {
		background-color: #f0f4f7;
		width: 90%;
		height: 70rpx;
		margin: 0 auto;
		margin-top: 80rpx;
		border-radius: 50rpx;

		image {
			display: flex;
			margin: 20rpx 30rpx 0 40rpx;
		}

		view {
			font-size: 28rpx;
			color: #545556;
			margin-top: -35rpx;
			margin-left: 90rpx;

		}
	}

	.list-center {
		justify-content: center;
		padding-bottom: 20rpx;
	}

	.fs {
		font-size: 28rpx;
		margin-top: 20rpx;
		margin-left: 15rpx;
		color: #999;
	}

	.super_then {
		padding: 20rpx;
		width: 42%;
		display: flex;
		height: 150rpx;
		background: #fff;
		border-radius: 16rpx;
		margin-bottom: 20rpx;
	}

	.super_left_text {
		font-size: 22rpx;
		color: #999999;
		height: 68rpx;
		zoom: 0.9;
	}

	.super_left {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.super_go {
		font-size: 30rpx;
		color: #fff;
		font-style: initial;
		background: linear-gradient(to right, #fe8e47, #ff551f);
		display: flex;
		padding: 2px 10px;
		border-radius: 20px;
		zoom: 0.9;
		font-weight: 600;
		font-style: italic;
		justify-content: space-between;
		width: 65%;
		letter-spacing: 1px;
	}

	.list {
		width: 180rpx;
		text-align: center;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.list-image {
		width: 70rpx;
		height: 78rpx;
		margin-left: 10rpx;
		margin-top: 40rpx;
	}

	.ls {
		letter-spacing: 2rpx;
		font-size: 28rpx;
		margin-top: 10rpx;
	}

	.lp {
		letter-spacing: 2rpx;
	}

	.grid {
		background-color: white;
		width: 345rpx;
		height: 100%;
		border-radius: 20rpx;
		margin-left: 1%;
		margin-top: 25rpx;
	}

	.text {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		letter-spacing: 2rpx;
		word-break: normal;
		overflow: hidden;
		text-overflow: ellipsis;
		margin-top: 5rpx;
		margin-left: 15rpx;
		font-size: 28rpx;
	}

	.grid-text {
		color: #999;
		font-size: 24rpx;
		letter-spacing: 3rpx;
		margin: 10rpx 0 20rpx 15rpx;
	}

	.price {
		color: #29ad97;
		margin-left: 15rpx;
		margin-bottom: 10rpx;
	}

	.sale1 {
		font-size: 26rpx;
		letter-spacing: 3rpx;
		color: #999;
		margin-top: 5rpx;
	}

	.six {
		margin-left: 10rpx;
		margin-right: 25rpx;
	}

	.grid-image {
		width: 165rpx;
		height: 180rpx;
		margin: 70rpx 0 30rpx 100rpx;
	}

	.downloading {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 10000;

		.downloading-img {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
		}
	}
</style>
